/*
 * File:   PrimaryStateInit.c
 * Author: craigjb
 *
 * Created on April 15, 2013, 3:57 PM
 */

#include <p24FJ64GA002.h>
#include "states.h"
#include "pwm.h"
#include "sensors.h"
#include "tick.h"
#include "rf_module.h"

void PrimaryStateInit(void)
{
    InitializeTick();

    InitializeSensors();
    StartSensors();

    InitializePWM();
    StartPWM();
    Stop();

    RFModuleInit();

    // for testing, go to PRIMARY_STATE_FOLLOW_TAPE
    SetCurrentPrimaryState(PRIMARY_STATE_SEARCH_IR);
    //SetCurrentPrimaryState(PRIMARY_STATE_FOLLOW_TAPE);
    //SetCurrentPrimaryState(PRIMARY_STATE_LEAVE_TAPE);
}
